/*
 * Copyright (C) 2006-2012 TongYan Corporation
 * All rights reserved.
 *
 * @brief info:
 *
 * @author: 王哲成 - wangzhecheng@yeah.net
 * @date: 2021.05.25
 * @last modified: 2021-05-25 10:49
 *
 */

#include "../include/PeaksFunction.hpp"
#include <cmath>

double PeaksInMatlab::functionValue(const double &x, const double &y) {
  return 3 * std::pow(1 - x, 2) *
             std::exp(-std::pow(x, 2) - std::pow(y + 1, 2)) -
         10 * (x / 5. - std::pow(x, 3) - std::pow(y, 5)) *
             std::exp(-x * x - y * y) -
         1. / 3. * exp(-std::pow(x + 1, 2) - y * y);
}

double PeaksValue::functionValue(const Vector &x) const {
  return PeaksInMatlab::functionValue(x[0], x[1]);
}

double PeaksSquareDerivation::functionValue(const Vector &) const { return 0; }
